package utils

import (
	"context"
	"git.mycaigou.com/gfyx/micro-gfyx-oppty-service/infrastructure/common/constants"
)

func GetClientIp(ctx context.Context) string {
	clientIp := ctx.Value(constants.ClientIp)
	if clientIp == nil {
		return ""
	}
	clientIpStr, ok := clientIp.(string)
	if !ok {
		return ""
	}
	return clientIpStr
}

func GetDevice(ctx context.Context) string {
	clientIp := ctx.Value(constants.Device)
	if clientIp == nil {
		return ""
	}
	clientIpStr, ok := clientIp.(string)
	if !ok {
		return ""
	}
	return clientIpStr
}
